package mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import pojo.User;

import java.util.List;

public interface UserMapper {
    @Select("select * from t_user")
   List<User> selectAll();

  @Select("select * from t_user WHERE id = #{id}")
  User selectOne(int id);

    //    插入
    @Insert("INSERT into t_user(id,username,fullname,password,address) VALUES(#{id},#{username},#{fullname},#{password},#{address})")
    void insertOne(User user);

    //    删除
    @Delete("DELETE FROM t_user WHERE id = #{id}")
    void deleteOne(int id);

    //    修改
    @Update("UPDATE t_user set username=#{username},fullname=#{fullname},password=#{password},address=#{address} WHERE id=#{id}")
    void updateOne(User user);
//    User selectOne(int id);
//
//    void insertOne(User user);
}

